/*
 *  Signiture.h
 *  TubeTruck
 *
 *  Created by Aeturnum on 5/21/08.
 *  Copyright 2008 __MyCompanyName__. All rights reserved.
 *
 */

#pragma once

#include <vector>
#include "Serializable.h"

namespace TTP {
   namespace Crypt {
      
      class Signiture : public std::vector<byte>,  public Serializable {
      public:
         
         enum {Length = 128};
         
         Signiture() : std::vector<byte>(Length)
         {}
         Signiture(std::vector<byte> sigData) : std::vector<byte>(sigData)
         {}
         
         ~Signiture() {
         }
         
         std::vector<byte> getBlankSigniture() const {
            std::vector<byte> blank;
            blank.insert(blank.end(), size(), 0);
            return blank;
         }
         
         std::vector<byte>& getSigniture() {
            return *this;
         }
         
         Signiture& operator=(const Signiture& o) {
            std::vector<byte>::operator=(o);
            return *this;
         }
         
         void fromVec(std::vector<byte>::const_iterator &vit, 
          const std::vector<byte>::const_iterator &end) {
            clear();
            for(int i = 0; i < Length; i++) {
               push_back(*vit++);
            }
         }
         
         void toVec(std::vector<byte> &vec) const {
            vec.insert(vec.end(),begin(), end());
         }
      };
      
   }
}
